Repository navigation
feat(tui): /model 运行中切换立即对下一次请求生效 - #9
Merged
Merged
Conversation
TUI 侧对齐上游 pi 的 per-request 模型解析语义(agent #7 / code #8 已合入, 本提交补齐 tui domain):/model 与 /thinking 切换后不再等到本轮结束,而是 在每次新的 Provider 请求前由 prepare-request 钩子解析最新选择并派生完整 effective-cfg,立即作用于续轮、steering、follow-up 与下一条普通消息。 TUI 状态与发布链路 - state.scm:新增 request-selection-chan 字段,删除 pending-model-switch。 - app.scm:创建并传入 request-selection-chan,启动 worker 时一并传递。 - 新增 app-selection.scm:集中 latest-wins 发布辅助,/model 与 /thinking 共用, 避免互相覆盖;发布失败以错误卡片提示,不静默吞掉。 - app-model.scm:/model 无论 busy/idle 都立即更新界面并发布选择快照, 提示卡片改为 \"Model: ...\" / \"Default model: ...\",删除延迟切换逻辑。 - app-thinking.scm:显式 /thinking 修改后发布当前完整快照,避免被较早的 /model 快照覆盖。 - app-events.scm:删除 agent_settled/error 时的补发\"已经切换到\"逻辑。 Worker 与上下文窗口 - 新增 worker-model.scm:effective-cfg 容器与 prepare-request 构造器, 排空通道、latest-wins、跨 provider 执行 augment、同步 thinking 与显式标志。 - worker.scm:贯穿 Worker 生命周期持有 effective-cfg,消息任务接入 prepare-request; 非消息任务(落盘/统计/resume/reload)不误清当前模型选择。 - worker-emit.scm:make-tui-emit 支持数字窗口与动态 getter;all-in-one 实际节点 窗口仅作用于本次请求,agent_settled 时清除,避免污染普通模型。 Footer 清理 - footer.scm / footer-model.scm:删除 pending-from 字段及双段展示, pi-footer-set-active-node! 恢复只维护 all-in-one 实际节点。 测试 - 搬运 worker-model / worker / app-selection / state 的切换回归测试。 - 新增 pi-make-effective-cfg-box / pi-effective-cfg-ref / pi-effective-cfg-set! / pi-worker-apply-selection / pi-worker-make-prepare-request 单测, 补齐 goldcheck unit-test 规则要求的导出函数测试文件。 - 删除只服务于延迟切换语义的 pending-model 测试。 全部通过 gf test agent/code/tui (120+585+517)、gf fmt --check、gf check。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
对齐上游 pi 的
prepareRequest语义(承接 #7 agent 层、#8 code 层,本 PR 补齐 tui domain):/model与/thinking切换后不再等到本轮结束,而是在每次新的 Provider 请求前由prepare-request钩子解析最新选择并派生完整 effective-cfg,立即作用于续轮、steering、follow-up 与下一条普通消息。承接并取代 #6(其 agent/code 部分已分别经 #7/#8 合入,tui 部分由本 PR 提供,可关闭 #6)。
改动
TUI 状态与发布链路
state.scm:新增request-selection-chan字段,删除pending-model-switch。app.scm:创建并传入request-selection-chan,启动 worker 时一并传递。app-selection.scm:集中 latest-wins 发布辅助,/model与/thinking共用,避免互相覆盖;发布失败以错误卡片提示,不静默吞掉。app-model.scm:/model无论 busy/idle 都立即更新界面并发布选择快照,提示卡片改为Model: .../Default model: ...,删除延迟切换逻辑。app-thinking.scm:显式/thinking修改后发布当前完整快照,避免被较早的/model快照覆盖。app-events.scm:删除agent_settled/error时的补发"已经切换到"逻辑。Worker 与上下文窗口
worker-model.scm:effective-cfg 容器与prepare-request构造器,排空通道、latest-wins、跨 provider 执行 augment、同步 thinking 与显式标志。worker.scm:贯穿 Worker 生命周期持有 effective-cfg,消息任务接入prepare-request;非消息任务(落盘/统计/resume/reload)不误清当前模型选择。worker-emit.scm:make-tui-emit支持数字窗口与动态 getter;all-in-one 实际节点窗口仅作用于本次请求,agent_settled时清除,避免污染普通模型。Footer 清理
footer.scm/footer-model.scm:删除pending-from字段及双段展示,pi-footer-set-active-node!恢复只维护 all-in-one 实际节点。测试
pi-worker-model-switch/pi-worker-prepare-request/pi-app-publish-request-selection-bang/pi-app-request-selection-chan等切换回归测试。pi-make-effective-cfg-box/pi-effective-cfg-ref/pi-effective-cfg-set!/pi-worker-apply-selection/pi-worker-make-prepare-request单测,补齐 goldcheckunit-test规则要求的导出函数测试文件。pi-app-submit-model/pi-app-model-session-state/pi-app-submit-thinking/pi-footer-right-part等回归;删除只服务于延迟切换语义的 pending-model 测试。验证
gf test agent(120)、gf test code(585)、gf test tui(517)全部通过gf fmt --check通过gf check全部规则通过